﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace QuanLyThuNgan
{
    public class ThuocNoiTruMstDAO
    {

        public string m_Insert_(string sobn, string ngay, string Makho, int sotien, string madvpk, string chandoan, int idnguoinhap, string yymm, string SoHS, string SoNhapvien, int tientra, string tungay, string denngay, string HA, int Mach, string ghichu, int NhietDo, string thetrang, int idbacsi, string GhiChuUni, string TheTrangUni, string ChandoanUni,int doituong)
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_ThuocNoiTruMst_Insert '{0}','{1}','{2}',{3},'{4}',N'{5}',{6},'{7}','{8}','{9}',{10},'{11}','{12}','{13}',{14},N'{15}',{16},N'{17}', {18}, N'{19}', N'{20}',N'{21}',{22}",
                                                                    sobn, ngay, Makho, sotien, madvpk, chandoan, idnguoinhap, yymm, SoHS, SoNhapvien, tientra, tungay, denngay, HA, Mach, ghichu, NhietDo, thetrang, idbacsi, GhiChuUni, TheTrangUni, ChandoanUni,doituong);          
            return _sql;
        }
        public string m_Delete_(string sobn)
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_ThuocNoiTruMst_Delete '{0}'", sobn);
            return _sql;
        }
        public string m_Update_(string sobn, string ngay, string Makho, int sotien, string madvpk, string chandoan, int idnguoinhap, string yymm, string SoHS, string SoNhapvien, int tientra, string tungay, string denngay, string HA, int Mach, string ghichu, int NhietDo, string thetrang, int idbacsi, string GhiChuUni, string TheTrangUni, string ChandoanUni, int doituong)
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_ThuocNoiTruMst_Update '{0}','{1}','{2}',{3},'{4}',N'{5}',{6},'{7}','{8}','{9}',{10},'{11}','{12}','{13}',{14},N'{15}',{16},N'{17}', {18}, N'{19}', N'{20}',N'{21}',{22}",
                                                                    sobn, ngay, Makho, sotien, madvpk, chandoan, idnguoinhap, yymm, SoHS, SoNhapvien, tientra, tungay, denngay, HA, Mach, ghichu, NhietDo, thetrang, idbacsi, GhiChuUni, TheTrangUni, ChandoanUni,doituong);          
            return _sql;
        }
        
        public DataTable m_soluongtonkhonoitru(string madv)
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_pharma_soluongtonkhonoitru '{0}',{1}", madv, 1);
            return Uit.it_SQL.getDataTable(_sql);
        }
        
        public DataTable m_kholtmp_toapk()
        {
            string _sql = string.Format("exec  dbo.usp_ThuNgan_ThuocNoiTru_Kholtmp_toapk ");
            return Uit.it_SQL.getDataTable(_sql);
        }
        public object m_KiemTraXuatVien(string sonv)
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_KiemTraXuatVien '{0}'", sonv);
            return Uit.it_SQL.ExecuteScalar(_sql);
        }
        public DataTable m_UpdateSoLuongTon_kholtmp_toapk(string sobn, int bdid)
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_ThuocNoiTru_soluongtonkhiupdate '{0}',{1}",sobn, bdid);
            return Uit.it_SQL.getDataTable(_sql);
        }
        public object m_KiemTraTraThuoc(string sophieu)
        {
            string _sql = string.Format("exec dbo.sp_ThuNgan_ThuocNoitru_checktrathuoc '{0}'", sophieu);
            return Uit.it_SQL.ExecuteScalar(_sql);
        }
        public string m_Update_TraThuoc(string sobn,string sonhapvien,int tientra,int idlydotra,int idtrathuoc,int idbstra)
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_ThuocNoiTruMst_TraThuoc_Update '{0}','{1}',{2},{3},{4},{5}", sobn, sonhapvien, tientra, idlydotra, idtrathuoc, idbstra);
            return _sql;
        }
        
        }
    
}
